package com.threeCountry;

/**
 * Created by yijy on 2017/7/31.
 */
public class Hero extends Thread{
    public volatile TaskFarmerArmy normalArmy;

    private int blood=100;

    public Hero(TaskFarmerArmy normalArmy) {
        this.normalArmy = normalArmy;
    }

    @Override
    public void run() {
        for(int i=0;i<10;i++){
            normalArmy.blood--;
            System.out.println(Thread.currentThread().getName()+"进攻对方:"+i+";"+normalArmy.blood);
            Thread.yield();
        }
    }
}
